package com.yssoft.controller.supervise;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.yssoft.service.core.PersonService;

/**
 * @类名称: WarningPersonController
 * @类描述: 人员证照预警控制器
 * @作者: 王永宁
 * @创建时间:2018年6月11日 下午3:01:50
 */
@Controller
@RequestMapping("/warning/warningPerson")
public class WarningPersonController {

    @Resource
    private PersonService personService;
    
	
    /**
     * 跳转到人员证照预警页面
     * @return
     */
    @RequestMapping("/personPage")
    public String personPage(Model model) {
    	model.addAttribute("type", 1);
        return "supervise/warning/personListNew";
    }
    
    /**
     * 获取人员证照预警数据
     * 王永宁
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("/findPersonPage")
    @ResponseBody
    public JSONObject findPersonPage(@RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "limit", defaultValue = "10") int limit, String companyId,String card,String health,String test, String name) {
    	JSONObject jsonObject = personService.queryWarningPersonPage(page, limit,companyId,card,health,test, name);
        return jsonObject;
    }
    
    
    /**
     * 获取人员证照预警数据-new
     * 王永宁
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("/findPersonPageNew")
    @ResponseBody
    public JSONObject findPersonPageNew(Model model,@RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "limit", defaultValue = "10") int limit, String companyId,String card,String type) {
    	model.addAttribute("type", type);
    	JSONObject jsonObject = personService.queryWarningPersonPageNew(page, limit,companyId,card,type);
        return jsonObject;
    }

}
